﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PersonEmpCertDetail.aspx.cs"
    Inherits="RN.ERP.Web.Person.PersonEmpCertDetail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../Styles/skins/blue/css/style.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/skins/blue/css/style_msg.css" rel="stylesheet" type="text/css" />
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script src="../Scripts/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Scripts/iepngfix_tilebg.js"></script>
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript" language="javascript" src="../Scripts/json-data.js"></script>
    <style type="text/css">
        .IE6png
        {
            behavior: url("../Scripts/iepngfix.htc");
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server">
    </asp:ScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ajaxsettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgPersonList" LoadingPanelID="gridLoadingPanel">
                    </telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </ajaxsettings>
    </telerik:RadAjaxManager>
    <input id="hdEmpID" type="hidden" runat="server" value="0" />
    <input id="hdEmpGuid" type="hidden" runat="server" value="" />
    <input id="hdCorpGuid" type="hidden" runat="server" value="" />
    <input id="HdAreaCode" type="hidden" runat="server" value="" />
    <input id="hdManual" type="hidden" runat="server" value="" />
    <input id="hdZjEmpId" type="hidden" runat="server" value="0" />
    <table width="970" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td width="16" class="title_lbg IE6png">
            </td>
            <td width="24" class="title_t IE6png">
            </td>
            <td width="913" class="title_libg IE6png">
                <asp:Literal ID="lblTitle" runat="server">人员执业手册</asp:Literal>
            </td>
            <td width="17" class="title_rbg IE6png">
            </td>
        </tr>
        <tr>
            <td class="border_lbg IE6png">
                &nbsp;
            </td>
            <td colspan="2">
                <div>
                    <div class="xian">
                        <div class="about_title">
                            人员信息</div>
                        <div class="i-con-cn">
                        </div>
                    </div>
                    <table border="0" width="100%" cellspacing="0" cellpadding="0" class="tab">
                        <tr>
                            <td style="width: 80px;">
                                姓名
                            </td>
                            <td align="left">
                                <a href="javascript:void(0);" id="a_emp">
                                    <asp:Label ID="lblempName" runat="server" ForeColor="#43a9f5"></asp:Label></a>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                企业名称
                            </td>
                            <td align="left">
                                <asp:Label ID="lblCorpName" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </div>
                <!--#人员执业手册-->
                <div id="empManual" runat="server">
                    <div class="xian">
                        <div class="about_title">
                            人员执业手册</div>
                        <div class="i-con">
                            <div id="scBtnDiv" runat="server" visible="false">
                                <a href="javascript:void(0);" id="QualscAdd" title="添加">
                                    <img src="../images/addicon.jpg" width="17" height="16" /></a> <a href="javascript:void(0);"
                                        id="QualscEdit" title="修改">
                                        <img src="../images/editicon.jpg" width="17" height="16" /></a> <a href="javascript:void(0);"
                                            id="QualscDel" title="删除">
                                            <img src="../images/deleteicon.jpg" width="17" height="16" /></a>
                            </div>
                            <div id="PrintbtnBtnDiv" runat="server" visible="false">
                                <a href="javascript:void(0);" id="Printbtn" title="打印">
                                    <img src="../images/print.jpg" width="17" height="16" alt="打印" /></a>
                            </div>
                        </div>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
                        <tr>
                            <td width="8%" bgcolor="#f2f2f2">
                                <strong>选择</strong>
                            </td>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>证书类别</strong>
                            </td>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>证书编号</strong>
                            </td>
                            <td width="10%" bgcolor="#f2f2f2">
                                <strong>证书等级</strong>
                            </td>
                            <td width="20%" bgcolor="#f2f2f2">
                                <strong>专业</strong>
                            </td>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>签发日期</strong>
                            </td>
                            <td width="15%" bgcolor="#f2f2f2">
                                <strong>审核状态</strong>
                            </td>
                        </tr>
                        <tbody id="EmpQualitiesSC">
                        </tbody>
                    </table>
                </div>
                <div class="hx_bg">
                </div>
                <!--#人员执业手册-->
                <!--#总代在建项目-->
                <div>
                    <div class="xian">
                        <div class="about_title">
                            人员相关项目</div>
                    </div>
                    <telerik:RadGrid ID="rgPersonList" runat="server" OnNeedDataSource="rgPersonList_NeedDataSource"
                        AutoGenerateColumns="False" AllowPaging="True" AllowCustomPaging="True" AllowSorting="True"
                        ShowStatusBar="True" CellSpacing="0" Culture="zh-CN" GridLines="None" PageSize="5">
                        <clientsettings reordercolumnsonclient="True" allowcolumnsreorder="True" enablerowhoverstyle="true">
                        </clientsettings>
                        <mastertableview autogeneratecolumns="False" nomasterrecordstext="暂无数据">
                            <Columns>
                                
                                     <telerik:GridBoundColumn DataField="CorpName" HeaderText="企业名称" HeaderStyle-HorizontalAlign="Center"
                                    SortExpression="CorpName" UniqueName="CorpName">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Title" HeaderText="工程名称" HeaderStyle-HorizontalAlign="Center"
                                    SortExpression="Title" UniqueName="Title">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="projectmanagerzj" HeaderText="项目总监" HeaderStyle-HorizontalAlign="Center"
                                    SortExpression="projectmanagerzj" UniqueName="projectmanagerzj">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                     <ItemStyle Width="70px"></ItemStyle>
                                </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="ProjectManagerZD" HeaderText="项目总代" HeaderStyle-HorizontalAlign="Center"
                                    SortExpression="ProjectManagerZD" UniqueName="ProjectManagerZD">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    <ItemStyle Width="70px"></ItemStyle>
                                </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="ProjectManagerJLY" HeaderText="监理员" HeaderStyle-HorizontalAlign="Center"
                                    SortExpression="ProjectManagerJLY" UniqueName="ProjectManagerJLY">
                                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                    <ItemStyle Width="70px"></ItemStyle>
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Cost" HeaderText="造价(万元)" SortExpression="Cost"
                                    UniqueName="Cost">
                                  
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Areas" HeaderText="面积(㎡)" SortExpression="Areas"
                                    UniqueName="Areas">
                                   
                                </telerik:GridBoundColumn>
                                   <telerik:GridTemplateColumn HeaderText="中标时间" HeaderStyle-HorizontalAlign="Center"
                                    ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                      <%#Eval("IsrtDate","{0:yyyy-MM-dd}")%>
                                    </ItemTemplate>
                                    <ItemStyle Width="70px"></ItemStyle>
                                </telerik:GridTemplateColumn>
                               
                                    <telerik:GridTemplateColumn HeaderText="竣工时间" HeaderStyle-HorizontalAlign="Center"
                                    ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                      <%#Eval("EndDate","{0:yyyy-MM-dd}")%>
                                    </ItemTemplate>
                                    <ItemStyle Width="70px"></ItemStyle>
                                </telerik:GridTemplateColumn>
                                 <telerik:GridTemplateColumn HeaderText="项目状态" HeaderStyle-HorizontalAlign="Center"
                                    ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                     <%# GetProjectStatus(Eval("bStatus"))%>
                                    </ItemTemplate>
                                    <ItemStyle Width="60px"></ItemStyle>
                                </telerik:GridTemplateColumn>
                             
                            </Columns>
                            <PagerStyle AlwaysVisible="True"></PagerStyle>
                        </mastertableview>
                        <pagerstyle alwaysvisible="True" />
                        <filtermenu enableimagesprites="False">
                        </filtermenu>
                    </telerik:RadGrid>
                </div>
                <!--#总代在建项目结束-->
                <div runat="server" id="btnShDiv" visible="false">
                    <div class="xian">
                        <div class="about_title">
                            信息审核</div>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
                        <tr bgcolor="#f2f2f2">
                            <td align="right" width="150">
                                审核意见
                            </td>
                            <td>
                                <div>
                                    <textarea id="txtContext" cols="220" rows="4" style="width: 760px; height: 50px;
                                        margin-top: 5px; border: 0;"></textarea>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <div class="xx_tab">
                        <ul>
                            <li class="icon01 IE6png"><a id="btnThSave" href="javascript:void(0);">退回</a> </li>
                            <li class="icon01 IE6png"><a id="btnShSave" href="javascript:void(0);">审核</a> </li>
                        </ul>
                    </div>
                </div>
                <div class="xx_tab" runat="server" id="btnPostDiv" visible="false">
                    <ul>
                        <li class="icon01 IE6png"><a href="javascript:void(0);" id="QualSubmint">上报 </a>
                        </li>
                    </ul>
                </div>
            </td>
            <td class="border_rbg IE6png">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="border_lconer IE6png" headers="17">
                &nbsp;
            </td>
            <td colspan="2" class="border_bottomli IE6png" height="17">
                &nbsp;
            </td>
            <td class="border_rconer IE6png" headers="17">
                &nbsp;
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
<script type="text/javascript">
    /*初始化页面*/
    function Initial() {
        $("#btnShSave").click(function () {
            CheckCertAudit(5);
        });
        $("#btnThSave").click(function () {
            CheckCertAudit(6);
        });
    }
    $(function () {
        var empguid = $("#<%=hdEmpGuid.ClientID %>").val();
        $("#a_emp").click(function () {
            ShowViewForm(empguid);
        });
    });
    /*打开窗口*/
    function ShowViewForm(empGuid) {
        top.$.ligerDialog.open({ url: "Person/PersonEmpView.aspx?empGuid=" + empGuid + "&opt=2", width: 1080, height: 800, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
        return false;
    }
</script>
<script type="text/javascript">
    /*主函数*/
    var optType;
    var message;
    $(function () {

        empGuid = $("#<%= hdEmpGuid.ClientID%>").val();
        corpGuid = $("#<%=hdCorpGuid.ClientID %>").val();
        areaCode = $("#<%=HdAreaCode.ClientID %>").val();
        // editStatus = "<%=EditStatus %>";
        manual = $("#<%=hdManual.ClientID %>").val();
        CardBindBtnClick();
        userRole = "<%=UserRole %>";
        if (manual != "") {
            GetEmpQualitiesSC();
        }
        Initial();
        //  SetControlEdit(editStatus);
    });

    /*绑定按钮事件*/
    function CardBindBtnClick() {

        //人员手册
        $("#QualscAdd").click(function () {
            ShowAddForm("PersonEmpManual.aspx?empGuid=" + empGuid + "&manual=" + manual, 800, 600);
        });
        $("#QualscEdit").click(function () {
            ShowEditForm("PersonEmpManual.aspx?empGuid=" + empGuid + "&manual=" + manual + "&certGuid=", "EmpQualitiesSC", 800, 600);
        });
        $("#QualscDel").click(function () {
            EmpQualscDel("QualitieDel", "EmpQualitiesSC");
        });
        $("#QualSubmint").click(function () {
            CheckAudit();
        });
        $("#Printbtn").click(function () {
            EmpQualscPrint("EmpQualitiesSC");
        });
    }
    function ShowAddForm(u, w, h, win) {

        win = win || this;
        win.ChildDialog = win.$.ligerDialog.open({ url: u, width: w, height: h, title: '', isResize: true });
        win.ChildDialogWin = this;
        // win.setChildDialogClose(this, "OnClientClose");
        return false;
    }
    /*打开编辑窗口*/
    function ShowEditForm(u, tbodyname, w, h) {

        var keyId = GetKeyID(tbodyname);
        if (keyId == "") {
            OpenAlert("请选择操作项！");
            return false;
        }
        if (keyId.indexOf(",") > 0) {
            OpenAlert("只能选择一个操作项！");
            return false;
        }

        $.ligerDialog.open({ url: u + keyId, width: w, height: h, title: '', isResize: true });

        // win.setChildDialogClose(this, "OnClientClose");
        return false;
    }
    /*打开添加窗口*/
    function ShowUpForm(u, w, h, win) {
        win = win || this;
        $.ligerDialog.open({ url: u, width: w, height: h, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
        win.ChildDialogWin = this;
        return false;
    }
    /*关闭窗口执行事件*/
    function OnClientClose(args) {
        var arg = args;
        if (arg) {
            if (arg.Result == 1) {
                return;
            }
            var childWinName = arg.childWinName;
            switch (childWinName) {

                case "CertSC":
                    GetEmpQualitiesSC();
                    break;
            }
        }

    }
    /*取得选择的项编号*/
    function GetKeyID(tbodyname) {
        var selstr = "";
        $("input[type='checkbox']:checked", $("#" + tbodyname)).each(function () {
            selstr += $(this).attr("id") + ",";
        });
        if (selstr != "") {
            selstr = selstr.substring(0, selstr.length - 1);
        }
        return selstr;
    }
    /*删除人员手册*/
    function EmpQualscDel(action, tbodyname) {
        if (!EmpDelCheck(tbodyname)) {
            return false;
        }
        var keyId = GetKeyID(tbodyname);
        if (confirm("您确定要删除此信息！")) {
            $.getJSON("../Handlers/PsnEmpInfoHandler.ashx", { "action": action, "empGuid": empGuid, "keyId": keyId, "areaCode": areaCode, "rand": Math.random() }, function (data) {
                OpenAlert(data.Message);
                GetEmpQualitiesSC();
            });

        }
        return false;
    }
    function EmpDelCheck(tbodyname) {

        var keyId = GetKeyID(tbodyname);
        if (keyId == "") {
            OpenAlert("请选择操作项！");
            return false;
        }
        return true;
    }
    /*打印*/
    function EmpQualscPrint(tbodyname) {
        if (!EmpDelCheck(tbodyname)) {
            return false;
        }
        ///取得证书类型
        var keyId = "";
        var certCode = "";
        $("input[type='checkbox']:checked", $("#" + tbodyname)).each(function () {
            keyId += $(this).attr("typeflag") + ",";
            certCode += $(this).attr("certCode") + ",";
        });
        if (keyId != "") {
            keyId = keyId.substring(0, keyId.indexOf(","));
        }
        if (certCode != "") {
            certCode = certCode.substring(0, certCode.indexOf(","));
        }
        window.open("../Person/PersonEmpCertPrintAdd.aspx?empGuid=" + empGuid + "&typeflag=" + keyId + "&certCode=" + certCode);
        return false;
    }
    /*加载人员执业手册数据*/
    function GetEmpQualitiesSC() {
        $.getJSON("../Handlers/PsnEmpInfoHandler.ashx", { "action": "QualitieSC", "empGuid": empGuid, "type": manual, "areaCode": areaCode, "rand": Math.random() }, function (data) {
            var innerHTML = "";

            $("#EmpQualitiesSC").empty();
            if (data != null && data.length > 0) {
                var GetCertificateDate = "";
                for (var i = 0, j = data.length; i < j; i++) {
                    var item = data[i];
                    if (item.GetCertificateDate != null && item.GetCertificateDate.length > 10) {
                        GetCertificateDate = item.GetCertificateDate.substring(0, 10);
                    } else {
                        GetCertificateDate = item.GetCertificateDate;
                    }
                    //                    if (item.CertificateName == "总监理工程师代表" && $("#hdcert").val() == "") {
                    //                        $("#hdcert").val(item.EducationGUID);
                    //                    }
                    innerHTML += ' <tr><td><input  type="checkbox" id="' + item.EducationGUID + '" typeflag="' + item.TypeFlags + '" certCode="' + item.CertificateCode + '"/></td>';
                    innerHTML += '<td>' + item.CertificateName + '</td><td><a onclick="return EmpQualitiesSCView(\'' + item.EducationGUID + '\');" href="javascript:void(0);"><span style="color: #43a9f5">' + item.CertificateCode + '</span></a></td>';
                    innerHTML += '<td>' + item.CLCode + '</td><td>' + item.CSCode + '</td><td>' + GetCertificateDate + '</td><td>' + item.StrFlowCode + '</td></tr>';
                }
            }
            $("#EmpQualitiesSC").append(innerHTML);
        });
    }
    function EmpQualitiesSCView(educationGUID) {
        ShowUpForm("PersonEmpManual.aspx?opt=2&empGuid=" + empGuid + "&certGuid=" + educationGUID + "&manual=" + manual, 800, 550);
    }
    /*弹出提示*/
    function OpenAlert(text) {
        $.ligerDialog.warn(text);
        return false;
    }

    function OpenConfirm(text, confirmCallBackFn) {
        $.ligerDialog.confirm(text, '', confirmCallBackFn);
        return false;
    }
    /*取得提示信息*/
    function GetMessage(opt) {
        var optTypeStr = '';
        var title = "";
        switch (opt) {
            case 4:
                optTypeStr = "信息上报";
                title = '您确定要上报所有信息，上报后信息不可再修改？';
                break;
            case 5:
                optTypeStr = "主管审核";
                title = '您确定要审核证书信息？';
                break;
            case 6:
            case 7:
                optTypeStr = "主管退回";
                title = '您确定要退回证书信息？';
                break;
            case 8:
                optTypeStr = "取消上报";
                title = '您确定要取消证书上报信息？';
                break;
        }
        return { message: optTypeStr, tootip: title };
    }
    /*上报*/
    function CheckAudit() {
      
        optType = 4;
        var obj = GetMessage(4);
        message = obj.message;
        OpenConfirm(obj.tootip, confirmCallBackFnAudit);
        return false;
    }
    /*审核*/
    function CheckCertAudit(opt) {
        if ($("#txtContext").val() == "") {
            OpenAlert("请添加审核意见！");
            $("#txtContext").focus();
            return false;
        }
        if ($("#txtContext").val().length > 200) {
            OpenAlert("审核意见内容过长！");
            $("#txtContext").select();
            return false;
        }
        optType = opt;
        var obj = GetMessage(opt);
        message = obj.message;
        OpenConfirm(obj.tootip, confirmCallBackFnAudit);
        return false;
    }
    function confirmCallBackFnAudit(arg) {
        if (arg) {
            var keyId = "";
            $("input[type='checkbox']", $("#EmpQualitiesSC")).each(function () {
                keyId += $(this).attr("id") + ",";
            });
            if (keyId != "") {
                keyId = keyId.substring(0, keyId.length - 1);
            }
            if (keyId == "") {
                OpenAlert("请添加执业手册！");
                return false;
            }
            var parmer = {};
            parmer.action = "Audit";
            parmer.empGuid = empGuid;
            parmer.certGuid = keyId;
            //parmer.areaCode = areaCode;
            parmer.message = message;
            parmer.optType = optType;
            parmer.descr = $("#txtContext").val();
            parmer.rand = Math.random();
            $.getJSON("PersonEmpManual.aspx", parmer, function (data) {

                if (data.Result) {
                    OpenAlertFn(data.Message, returnToParent);
                } else {
                    OpenAlert(data.Message);
                }
                GetEmpQualitiesSC();
            });
        }
    }
    function returnToParent() {
        top.ChildDialogCallBack = "RefreshToList";
        top.ChildDialogClose();
    }
    function OpenAlertFn(text, CallBackFn) {
        $.ligerDialog.warn(text, '', CallBackFn);
        return false;
    }
</script>
